/**
 * @Author: Lenovo
 * @Date: 2024/11/10 0:05
 * @description:
 */
public class Demo12 {
    public static void main(String[] args) throws InterruptedException {
        Thread t = new Thread(()->{
           for (int i = 0;i<5;i++){
               System.out.println("hello thread");
               try {
                   Thread.sleep(1000);
               } catch (InterruptedException e) {
                   throw new RuntimeException(e);
               }
           }
            System.out.println("t 线程结束");
        });
        t.start();
        t.join(3000);
        System.out.println("main 线程结束");
    }
}
